﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using CKSE.Interfaces;

namespace CKSE
{
    public class VirtualFolder : IFolder
    {
        #region Fields
        private readonly DirectoryInfo _physicalFolder;
        private readonly string _name;
        private readonly IFolder _parent;
        #endregion

        #region Properties
        public bool IsVirtual
        {
            get { return true; }
        }

        public string Name
        {
            get { return _name; }
        }
        public string FullPath
        {
            get
            {
                return _parent != null ? string.Concat(_parent.FullPath, '/', _name) : Name;
            }
        }
        public IFolder Parent
        {
            get { return _parent; }
        }
        public FileInfo[] Files
        {
            get { return _physicalFolder.GetFiles(); }
        }
        #endregion

        #region Life cycle
        public VirtualFolder(string name, IFolder parent)
        {
            _name = name;
            _parent = parent;
            _physicalFolder = new DirectoryInfo("C:");
        }
        #endregion        
    }
}
